import React from 'react'
import { View, Text } from '@tarojs/components'
import styles from './index.module.scss'

interface ProgressBarProps {
    progress?: number
    color?: string
    text?: string
}

const ProgressBar: React.FC<ProgressBarProps> = ({
    progress,
    color = '#bdd1e9',
    text,
}) => {
    return (
        <View className={styles.progressBar}>
            <View
                className={styles.fill}
                style={{ width: `${progress}%`, backgroundColor: color }}
            />
            {text && <Text className={styles.text}>{text}</Text>}
        </View>
    )
}

export default ProgressBar
